const Router = require('koa-router')
const router = new Router({
    prefix: '/api', // 接口前缀
})


// web
const user = require('./web/user')
const webGoods = require('./web/goods')
const webOrder = require('./web/order')
// admin
const account = require('./admin/account')
const adminGoods = require('./admin/goods')
const adminOrder = require('./admin/order')


router.use('/web', user.routes(), user.allowedMethods())
router.use('/web/goods', webGoods.routes(), webGoods.allowedMethods())
router.use('/web/self', webOrder.routes(), webOrder.allowedMethods())


// 商品相关的接口
router.use('/admin', account.routes(), account.allowedMethods())
router.use('/admin/goods', adminGoods.routes(), adminGoods.allowedMethods())
router.use('/admin/order', adminOrder.routes(), adminOrder.allowedMethods())


module.exports = router